package com.zzq.my.jetpacks.jectpackapp.adapter

import android.widget.ImageView
import com.zhpan.bannerview.BaseBannerAdapter
import com.zhpan.bannerview.BaseViewHolder
import com.zzq.my.jetpacks.jectpackapp.R
import com.zzq.my.jetpacks.util.loadImage

/*
  * ================================================
  * 描述：
  * 作者：zhuangzeqin
  * 时间: 2023/4/20 11:10
  * 邮箱：zzq@eeepay.cn
  * 备注:
  * ----------------------------------------------------------------
  * You never know what you can do until you try !
  *      _              _           _     _   ____  _             _ _
  *     / \   _ __   __| |_ __ ___ (_) __| | / ___|| |_ _   _  __| (_) ___
  *    / _ \ | '_ \ / _` | '__/ _ \| |/ _` | \___ \| __| | | |/ _` | |/ _ \
  *   / ___ \| | | | (_| | | | (_) | | (_| |  ___) | |_| |_| | (_| | | (_) |
  *  /_/   \_\_| |_|\__,_|_|  \___/|_|\__,_| |____/ \__|\__,_|\__,_|_|\___/
  *
  * 签名：最痛苦的事不是我失败了，而是我本可以.--zzq
  * ----------------------------------------------------------------
  * 不要在循环模式下使用{@link RecyclerView.ViewHolder#getAdapterPosition} 方法获取position，这个方法可能会返回一个不正确的position
    如果你需要通过getAdapterPosition()方法获取position，可参考如下代码:
     int adapterPosition = holder.getAdapterPosition();
     int realPosition = BannerUtils.getRealPosition(isCanLoop, adapterPosition, mList.size());
  * ================================================
  */
class SimpleAdapter : BaseBannerAdapter<String>() {
    override fun bindData(
        holder: BaseViewHolder<String>,
        data: String,
        position: Int,
        pageSize: Int
    ) {
        val bannerImgView = holder.findViewById<ImageView>(R.id.banner_image)
        bannerImgView.loadImage(data)
    }

    override fun getLayoutId(viewType: Int): Int = R.layout.item_view_banner
}